package com.yzt.dynamicmodule.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.zhuju.network.entity.home.SearchUserBean;
import com.yzt.zhuju.widget.GenderAgeView;
import com.yzt.dynamicmodule.R;

import com.yzt.plugin_imageloader.ImageLoadUtil;

/**
 * author : bob
 * date   : 2022/12/13
 * desc   : 用户搜索页面
 */
public class SearchUserAdapter extends BaseQuickAdapter<SearchUserBean, BaseViewHolder> {

    public SearchUserAdapter() {
        super(R.layout.item_search_user);
    }

    @Override
    protected void convert(BaseViewHolder holder, SearchUserBean item) {

        if (item.getRoomId() == 0) {
            holder.setGone(R.id.view_on_live, true);
            holder.setGone(R.id.img_on_live, true);
        } else {
            holder.setGone(R.id.view_on_live, false);
            holder.setGone(R.id.img_on_live, false);
        }

        ImageLoadUtil.loadAvatar(getContext(), item.getAvatar(), holder.getView(R.id.avater_riv));

        TextView mNickNameTv = holder.getView(R.id.nickname_tv);
        mNickNameTv.setText(item.getUserName());

        GenderAgeView genderAgeView = holder.getView(R.id.gender_age_view);
        genderAgeView.setUserInfo(item.getGender(), item.getAge());

        holder.setText(R.id.content_tv, "ID：" + item.getUid());
    }
}

